import Lottie from 'react-lottie';
import BaseReact from "../baseReact";
import {loading_animationData} from "../../blackimg/loading";

export default class DefaultLoading extends BaseReact {
    constructor(props){
        super(props);
        this.unique_name = 'DefaultLoading';
        this.state= Object.assign(this.state,{
          isStop:false,
        })
        this.state.isSelfShow = false;
        this.defaultOptions = {
        renderer: 'svg',
        loop: true,
        autoplay: true,
        animationData:loading_animationData
      }
    }
    componentDidMount(){
    }
    onEnter() {
      this.setState({isStop:false})
    }
    onExit() {
      this.setState({isStop:true})
    }
    render() {
        return (
          <div id="loading_common" style={{display:this.state.isSelfShow?'block':'none'}}>
            <Lottie options={this.defaultOptions} isStopped={this.state.isStop}></Lottie>
          </div>
        )
    }
}
